/*************************************************************************
 *                                                                       *
 * This file is part of the FreeMAPs distribution.  For full copyright   *
 * information, see COPYRIGHT and COPYING.LESSER.                        *
 *                                                                       *
 * Author:           sqbang                                              *
 * Email:            sqbang@ustc.edu                                     *
 * Date:             2011.08.12                                          *
 *                                                                       *
 *************************************************************************/

#ifndef FreeMAPs_include_COMMON_attr_Attribute_h
#define FreeMAPs_include_COMMON_attr_Attribute_h

#include "FreeMAPsConfig.h"

//LIBMESH headers

//COMMON headers
#include "COMMON/base/StateIndicator.h"
#include "COMMON/tbox/Bimap.h"

namespace FreeMAPs
{

//forward declearation
class AttributeDatabase;
class Function;

/**
 * @brief Used to save an attribute's information.
 *
 * attribute used to set region's property such as density, capacity, ..., etc.
 * attributes are identitied by their types and name.
 *
 * the main information is the coefficients that this attribute contains.
 * those coefficients can be used as the function's variable.
 * and their information may set directly or read from a out files(not in the input file).
 *
 * if the input is read from out files, a map from database to the file is required.
 * and the information will saved by a AttributeDatabase.
 */
class Attribute : public StateIndicator
{
public:

    /**
     * constructor function.
     */
    explicit
    Attribute (
        const std::string& parent_name,
        const std::string& attr_name);

    virtual
    ~Attribute();

public:

    /**
     * @return the name of the attribute
     */
    inline const std::string&
    get_attribute_name() const;


    inline const std::string&
    get_attr_db_file_name() const;

    inline void
    set_attr_db_file_name(
            const std::string& attr_db_file_name);


public:

    /**
     * clear the data in the class.
     */
    void
    clear();

    /**
     * get information from database
     */
    void
    get_from_input (
        const InputDatabase* db);

    friend std::ostream&
    operator << (
        std::ostream& os,
        const Attribute& rhs);

private:

    typedef StateIndicator Parent;

    std::string d_attr_name;

    std::string d_attr_db_file_name;


private:

    DISALLOW_COPY_AND_ASSIGN (Attribute);
};

}

#include "COMMON/attr/Attribute.inl"

#endif
